cabal-version:         2.2
name:                  finitary-derive
-- PVP summary:        +-+------- breaking API changes
--                     | | +----- non-breaking API additions
--                     | | | +--- code changes with no API change
version:               3.0.0.1
synopsis:              Flexible and easy deriving of type classes for finitary
                       types.
description:           Provides a collection of wrappers, allowing you to easily
                       define (among others) Unbox, Storable, Hashable and
                       Binary instances for finitary types with flexibility in
                       terms of representation and efficiency. Never write an
                       Unbox instance by hand again!
homepage:              https://notabug.org/sheaf/finitary-derive
license:               GPL-3.0-or-later
license-file:          LICENSE.md
author:                Koz Ross
maintainer:            Sam Derbyshire
copyright:             (C) Koz Ross 2019
category:              Data
tested-with:           GHC == 8.4.4,
                       GHC == 8.6.5,
                       GHC == 8.8.1,
                       GHC == 8.10.4,
                       GHC == 9.0.1
build-type:            Simple
extra-source-files:    CHANGELOG.md,
                       README.md

common common

  build-depends:
    finitary
      >= 1.2.0.0 && < 2.2,

    base
      >= 4.11 && < 4.16,
    binary
      >= 0.8.5.1 && < 0.11,
    deepseq
      >= 1.4.3.0 && < 1.5,
    finite-typelits
      >= 0.1.4.2 && < 0.2,
    hashable
      >= 1.3.0.0 && < 1.4,
    vector
      >= 0.12.0.3 && < 0.13,

  default-language:
    Haskell2010

  ghc-options:
    -Wall -Wcompat

library

  import:
    common

  hs-source-dirs:
    src

  exposed-modules:
    Data.Finitary.Finiteness,
    Data.Finitary.PackBits,
    Data.Finitary.PackBits.Unsafe,
    Data.Finitary.PackBytes,
    Data.Finitary.PackWords,
    Data.Finitary.PackInto

  build-depends:
    bitvec
      >= 1.1.1.0 && < 1.2,
    coercible-utils
      >= 0.0.0 && < 0.1,
    ghc-typelits-extra
      >= 0.3.1 && < 0.5,
    ghc-typelits-knownnat
      >= 0.7 && < 0.8,
    primitive
      >= 0.7.1.0 && < 0.8,
    vector-instances
      >= 3.4 && < 3.5,
    vector-binary-instances
      >= 0.2.5.1 && < 0.3,

  if impl(ghc >= 9.0)
    cpp-options:
      -DBIGNUM
    build-depends:
      ghc-bignum
        >= 1.0 && < 1.1,
  else
    build-depends:
      integer-gmp
        >= 1.0.2.0 && < 1.2,

test-suite tests

  import:
    common

  hs-source-dirs:
    test

  main-is:
    Main.hs

  type:
    exitcode-stdio-1.0

  build-depends:
    finitary-derive,

    hedgehog
      >= 1.0.1 && < 1.1,
    hedgehog-classes
      >= 0.2.4 && < 0.3,

  ghc-options:
    -O2 -threaded -rtsopts -with-rtsopts=-N
